package com.cardone.platform.usercenter.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.usercenter.dao.OrgDao;
import com.cardone.platform.usercenter.dto.OrgDto;

/**
 * 组织服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class OrgDefaultService implements OrgService {
	@Override
	public int deleteByIds(final OrgDto deleteOrg) {
		return ContextHolder.getBean(OrgDao.class).deleteByIds(deleteOrg);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final OrgDto findOrg) {
		return ContextHolder.getBean(OrgDao.class).findByCodeOrId(mappedClass, findOrg);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final OrgDto findOrg) {
		return ContextHolder.getBean(OrgDao.class).findById(mappedClass, findOrg);
	}

	@Override
	public <P> List<P> findListByIdForTree(final Class<P> mappedClass, final String id, final boolean isSuperRole) {
		return ContextHolder.getBean(OrgDao.class).findListByIdForTree(mappedClass, id, isSuperRole);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final OrgDto findListOrg) {
		return ContextHolder.getBean(OrgDao.class).findListByLikeCode(mappedClass, findListOrg);
	}

	@Override
	public int insertByCode(final OrgDto insertOrg) {
		return ContextHolder.getBean(OrgDao.class).insertByCode(insertOrg);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final OrgDto paginationOrg) {
		return ContextHolder.getBean(OrgDao.class).paginationByLikeCode(mappedClass, paginationOrg);
	}

	@Override
	public Integer readByCodeNqIdForCount(final OrgDto readOrg) {
		return ContextHolder.getBean(OrgDao.class).readByCodeNqIdForCount(readOrg);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final OrgDto saveOrg) {
		return ContextHolder.getBean(OrgDao.class).saveByIdOrCode(mappedClass, saveOrg);
	}

	@Override
	public int updateByCode(final OrgDto updateOrg) {
		return ContextHolder.getBean(OrgDao.class).updateByCode(updateOrg);
	}
}